import {request} from '@umijs/max';
import * as API from "@/services";


/** 期刊栏目 分页检索请求 */
export async function queryJournalColumns(params?: API.JournalColumnPageQueryParams): Promise<API.RespPageResult<API.JournalColumn>> {
  return request('/api/v1/journal-column', {
    params,
  });
}

/** 期刊栏目 详情请求 */
export async function queryJournalColumn(bizId: API.EntityId): Promise<API.RespResult<API.JournalColumn>> {
  return request(`/api/v1/journal-column/${bizId}`);
}

/** 期刊栏目 创建请求 */
export async function createJournalColumn(entity: API.JournalColumn_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column`, {
    method: 'POST',
    data: entity,
  });
}

/** 期刊栏目 修改请求 */
export async function modifyJournalColumn(entity: API.JournalColumn_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 期刊栏目 修改(部分)请求 */
export async function patchJournalColumn(entity: API.JournalColumn_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 期刊栏目 删除请求 */
export async function deleteJournalColumn(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/${bizId}`, {
    method: 'DELETE',
  });
}

/** 期刊栏目 批量删除请求 */
export async function deleteJournalColumns(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}


/** 期刊栏目 启用 */
export async function enableJournalColumn(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/enable/${bizId}`, {
    method: 'PUT',
  });
}

/** 期刊栏目 禁用 */
export async function disableJournalColumn(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/disable/${bizId}`, {
    method: 'PUT',
  });
}


/** 期刊栏目 标注为特色栏目 */
export async function markSpecialJournalColumn(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/${bizId}/special`, {
    method: 'POST',
  });
}

/** 期刊栏目 取消标注为特色栏目 */
export async function unMarkSpecialJournalColumn(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-column/${bizId}/unspecial`, {
    method: 'POST',
  });
}
